docs(label_pr.yml): add labels based on new PR title #1448
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Not sure if this works as expected, just trying.
The algorithm is not very strict, but I think it's still better than labeling manually by the maintainers.
To add or update labels according to a Pull Request (PR) title, you will need a custom step in your GitHub Actions workflow, because
[actions/labeler](https://github.com/actions/labeler)
works based on the files changed in the PR, not the PR title.Here’s how you can update your YAML to include PR title-based labeling using a
run:
script step:✅ Updated Workflow YAML
🔍 Explanation
actions/github-script
is used to run custom JavaScript using the GitHub API.context.payload.pull_request.title
) and determine what labels to apply.addLabels
method is used to apply the chosen labels to the PR.🧩 Tips
pull_request_target
so it will have access to secrets and permissions in the base repo.Let me know if you'd like to match against regex or support custom config files for title-label mappings.